<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>绑定手机号</title>
	<%@ include file="../common/common.jsp"%>
	<link rel="stylesheet" type="text/css" href="${ctx}/page/lib/other/css/main.css" />
</head>
<body>
<div class=" padding border-bottom margin">
	<div class=" form-group">
		<div class="field field-icon-right">
			<input type="text" class="input" id="mobile" name="mobile" placeholder="请输入手机号码" />
		</div>
	</div>	
</div>
<div class=" padding-big">
	<p class="text-red">说明：</p>
	<span class="text-red">
	1、充话费送等金额的积分，如：充100元话费则送100积分；
	<br>
	2、只能充值绑定的手机号，且绑定后无法更改，如果必须更改请联系客服；
	<br>
	3、话费是快充话费，3到5分钟内到账，最晚不超过24小时，支持移动、联通、电信。
	</span>
</div>

<div class="margin">
	<button class="button bg-green button-big button-block" onclick="sureCash()">确认绑定</button>
</div>

<script type="text/javascript">
	var flag = true;
	function sureCash(){
		if(flag){
			flag = false;
			var mobile = $("#mobile").val();
			if(mobile.length == 0){
				flag = true;
				alert("请输入手机号");
				return;
			}
			var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
			if (!reg.test(mobile)) {
				flag = true;
				alert("手机号码格式有误!");
				return;
			}
			$.ajax({
				type : 'POST',
				url : ctx + '/huafei/bindMobile.do',
				data : {
					mobile:mobile
				},
				dataType : 'json',
				timeout : 30000,
				context : $('body'),
				success : function(data) {
					if (data.code == "ok") {
						flag = true;
						window.location.href=mServerUrl+"/page/huaFeiPage.htm?time="+((new Date()).getTime());
					} else {
						flag = true;
						alert(data.msg);
					}
				},
				error : function(xhr, type) {
					flag = true;
					alert('提交失败!');
				}
			});
		}

	}

</script>
</body>
</html>